<?php include $this->admin_tpl('header'); ?>
<link rel="stylesheet" type="text/css" href="<?php echo JS_PATH;?>EasyUI/themes/haidaoblue/easyui.css">
<link rel="stylesheet" type="text/css" href="<?php echo JS_PATH;?>EasyUI/themes/icon.css">
<script type="text/javascript" src="<?php echo JS_PATH;?>EasyUI/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo JS_PATH;?>EasyUI/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<?php echo JS_PATH;?>EasyUI/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="<?php echo JS_PATH;?>EasyUI/hd_default_config.js"></script>
<div class="content" >
<div class="site">
	<?php echo C('site_name')?> <a href="#">加盟申请</a> > 最新加盟申请
</div>
<span class="line_white"></span>
<div class="install mt10">
	<div class="login mt10" style="border: none;">
			<table id="leaguelist" style="width:100%"></table>
			<div class="clear"></div>
		</div>
		<?php include $this->admin_tpl("copyright"); ?>
		<div class="clear"></div>
</div>
<script type="text/javascript">
	var dom = $('#leaguelist');
	var pageSize = <?php echo PAGE_SIZE?>;
	var dataurl = '<?php echo U('index')?>';
	var ststusurl = '<?php echo U('changeStatus')?>';
	$(function(){
		dom.datagrid({
			url:dataurl,
			striped:true,
			width:'100%',
			checkOnSelect:true,
			singleSelect:true,
			fitColumns:true,
			pagination:true,
			pageSize:pageSize,
			pageList: [pageSize,pageSize*2,pageSize*4],//可以设置每页记录条数的列表
			columns:[[
				{field:'company_name',title:'商店名称',width:'20%',align:'center'},
				{field:'realname',title:'联系人',width:'10%',align:'center'},
				{field:'phone',title:'联系电话',width:'10%',align:'center'},
				{field:'address',title:'商店地址',width:'21%',align:'center'},
				{field:'business',title:'经营范围',width:'10%',align:'center'},
				{field:'hangye',title:'行业分类',width:'10%',align:'center'},
				{field:'add_time',title:'提交时间',width:'10%',align:'center',
					formatter:function(value,row,index){
  						return $.fn.datebox.defaults.timeformat(value);
					}
				},
				{field:'none',title:'操作',width:'10%',halign:'center',align:'center',
					formatter:function(value,row,index){
						if(row.status == 1){
							var banhtml = '<a href="javascript:void(0)" onclick="chang_status(\'1\','+row.id+')">已经联系</a>&nbsp;&nbsp;&nbsp;&nbsp;';
						}else{
							var banhtml = '<a href="javascript:void(0)" onclick="chang_status(\'0\','+row.id+')" class="red">未联系</a>&nbsp;&nbsp;&nbsp;&nbsp;';
						}
						return banhtml;
					}
				},
			]],
		});
	});
	//状态
	function chang_status(method,id){
		$.messager.confirm('确认','当前加盟申请您确定已经联系过了吗？',function(r){
			if (r){
				$.getJSON(ststusurl,
				{"method":method,"id":id},
				function(data){
					if(1 == data.status){
						dom.datagrid("reload");  //重新加载
					}else{
						$.messager.alert('提示',data.info);
					}
				})
			}
		});
	}
</script>